package com.learning.spring.ioc.applicationcontext.config;

import com.learning.spring.ioc.applicationcontext.entity.Address;
import com.learning.spring.ioc.applicationcontext.entity.User;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

/**
 * ClassName: SpringContextConfig
 * Description:
 * Date: 2020/8/25 20:07 【需求编号】
 *
 * @author Sam Sho
 * @version V1.0.0
 */
@Configuration
public class SpringContextConfig {

    @Bean
    public User userAnnotationApplicationContextInit() {
        User user = new User();
        user.setName("Eason");
        user.setAge(4);
        return user;
    }


    @Bean
    @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
    public Address addressAnnotationApplicationContextInit() {
        Address address = new Address();
        address.setName("北京");
        return address;

    }
}
